/*    
    OpenMheg - A free MHEG-5 library
    Copyright (C) 2008 Dharmesh Malam

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.Text;

using Core.Model.Data.Generics;
using Core.Model;

namespace Core.Model.Ingredients.Presentable.Visibles
{
    public class LineArt : Visible
    {
       
        public enum LineArtLineStyle
        {
            Solid = 1,
            Dashed,
            Dotted
        }

        #region  Exchanged attributes
        private bool borderedBoundingBox = true;

        public virtual bool BorderedBoundingBox
        {
            get { return borderedBoundingBox; }
            set { borderedBoundingBox = value; }
        }
        private int originalLineWidth = 1;   

        public int OriginalLineWidth
        {
            get { return originalLineWidth; }
            set { originalLineWidth = value; }
        }
        private LineArtLineStyle originalLineStyle = LineArtLineStyle.Solid;

        public LineArtLineStyle OriginalLineStyle
        {
            get { return originalLineStyle; }
            set { originalLineStyle = value; }
        }
        private GenericColour originalRefLineColour = new GenericColour(new Colour(255, 255, 255, 0));//Black 

        public GenericColour OriginalRefLineColour
        {
            get { return originalRefLineColour; }
            set { originalRefLineColour = value; }
        }
        private GenericColour originalRefFillColour = new GenericColour(new Colour(0, 0, 0, 255));//Black 

        public GenericColour OriginalRefFillColour
        {
            get { return originalRefFillColour; }
            set { originalRefFillColour = value; }
        }
        #endregion

        #region  Internal attributes
        private int lineWidth;

        public int LineWidth
        {
            get { return lineWidth; }
            set { lineWidth = value; }
        }
        private LineArtLineStyle lineStyle;

        public LineArtLineStyle LineStyle
        {
            get { return lineStyle; }
            set { lineStyle = value; }
        }
        private GenericColour refLineColour;

        public GenericColour RefLineColour
        {
            get { return refLineColour; }
            set { refLineColour = value; }
        }
        private GenericColour refFillColour;

        public GenericColour RefFillColour
        {
            get { return refFillColour; }
            set { refFillColour = value; }
        }

        public override void InittInternalAttributes ()
        {
            base.InittInternalAttributes();

            lineWidth = originalLineWidth;
            lineStyle = originalLineStyle;
            refLineColour = originalRefLineColour;
            refFillColour = originalRefFillColour;
        }
        #endregion

        #region Actions
        public virtual void SetLineWidth ( GenericInteger newLineWidth )
        {
            lineWidth = newLineWidth.Value;

            if ( RunningStatus )
            {
                OnRedrawArea( BoxPosition, BoxSize );
            }
        }

        public virtual void SetLineStyle ( GenericInteger newLineStyle )
        {
            lineStyle = (LineArtLineStyle) newLineStyle.Value;

            if ( RunningStatus )
            {
                OnRedrawArea( BoxPosition, BoxSize );
            }
        }

        public virtual void SetLineColour ( GenericColour newLineColour )
        {
            refLineColour.Value =  newLineColour.Value;

            if ( RunningStatus )
            {
                OnRedrawArea( BoxPosition, BoxSize );
            }
        }

        public virtual void SetFillColour ( GenericColour newFillColour )
        {
            refFillColour.Value  = newFillColour.Value;

            if ( RunningStatus )
            {
                OnRedrawArea( BoxPosition, BoxSize );
            }
        }
        #endregion
    }
}
